// 入口文件
import Vue from 'vue'
import axios from 'axios'
import VueRouter from 'vue-router'
import app from './App.vue'
import moment from 'moment' //时间格式化插件

import router from './router.js'

// 导入MUI的样式
import './lib/mui/css/mui.min.css'

import './lib/mui/css/icons-extra.css'

// 按需导入 Mint-UI 中的组件
import { Header, Swipe, SwipeItem, Button } from 'mint-ui'

Vue.use(VueRouter)
Vue.component(Header.name, Header)
Vue.component(Swipe.name, Swipe)
Vue.component(SwipeItem.name, SwipeItem)
Vue.component(Button.name, Button)

Vue.prototype.$axios = axios;
axios.defaults.baseURL = 'http://jsonplaceholder.typicode.com';

//定义全局过滤器
Vue.filter('dateFormat', function(dataStr, pattern = "YYYY-MM-DD HH:mm:ss") {
    return moment(dataStr).format(pattern)
})

var vm = new Vue({
    el: '#app',
    render: c => c(app),
    router,
})